package com.design.patterns.list.factory.simplefactory;

import com.design.patterns.list.factory.*;

/**
 * 简单工厂封装pizza的实际实现过程。
 * @author Wangzhiwen
 */
public class SimpleFactory {

    public static Pizza createPizzaStatic(String pizzaName) {
        Pizza pizza;
        if ("APizza".equals(pizzaName)) {
            pizza = new APizza();
        } else if ("BPizza".equals(pizzaName)) {
            pizza = new BPizza();
        } else {
            pizza = new CPizza();
        }
        return pizza;
    }

    public Pizza createPizza(String pizzaName) {
        Pizza pizza;
        if ("APizza".equals(pizzaName)) {
            pizza = new APizza();
        } else if ("BPizza".equals(pizzaName)) {
            pizza = new BPizza();
        } else {
            pizza = new CPizza();
        }
        return pizza;
    }

}
